﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace ALE_Server.EC
{
    [Serializable]
    [DataContract]
    public class ECSpec
    {
        IList<ECLogicReader> m_Readers = new List<ECLogicReader>();
        ECBoundarySpec m_Boundaries;
        IList<ECReportSpec> m_ReportSpecs = new List<ECReportSpec>();
        bool m_IncludeSpecInReports;

        [DataMember]
        public IList<ECLogicReader> Readers
        {
            get
            {
                return m_Readers;
            }
            set
            {
                m_Readers = value;
            }
        }

        [DataMember]
        public ECBoundarySpec Boundaries
        {
            get
            {
                return m_Boundaries;
            }
            set
            {
                m_Boundaries = value;
            }
        }

        [DataMember]
        public IList<ECReportSpec> ReportSpecs
        {
            get
            {
                return m_ReportSpecs;
            }
            set
            {
                m_ReportSpecs = value;
            }
        }

        [DataMember]
        public bool IncludeSpecInReports
        {
            get
            {
                return m_IncludeSpecInReports;
            }
            set
            {
                m_IncludeSpecInReports = value;
            }
        }

        public void AddReader(ECLogicReader reader)
        {
            if (reader != null)
            {
                m_Readers.Add(reader);
            }
        }

        public void RemoveReader(ECLogicReader reader)
        {
            if (reader != null)
            {
                m_Readers.Remove(reader);
            }
        }

        public void AddReportSpec(ECReportSpec reportSpec)
        {
            if (reportSpec != null)
            {
                m_ReportSpecs.Add(reportSpec);
            }
        }

        public void RemoveReportSpec(ECReportSpec reportSpec)
        {
            if (reportSpec != null)
            {
                m_ReportSpecs.Remove(reportSpec);
            }
        }

        public override string ToString()
        {
            return XmlSerializeHelper.Serialize(this);
        }

    }
}
